 /* Jostick Light
  * ------------
  *
  * Reads two analog pins connected to a 2D jostick made of two potentiometers,
  * varies intensity of RGB LED.
  *
  */

 int joyUD = 0;       // slider variable connecetd to analog pin 0
 int joyLR = 1;       // slider variable connecetd to analog pin 1
 int UD = 0;          // variable to read the value from the analog pin 0 (Up, Down)
 int LR = 0;          // variable to read the value from the analog pin 1 (Left, Right)

 void setup() 
 {
  Serial.begin(9600);
 }
 
 void loop() {
  
  UD = analogRead(joyUD);   // reads the value of the variable resistor 
  delay(500);    	    // small pause may be needed between reading
                            // analog pins, otherwise may get same value twice
  LR = analogRead(joyLR);   // reads the value of the variable resistor 
  
  // joyUD/LR is digital representation of voltage across variable resistor
  // 10 bit digital rep give a value between 0-1023 
  
  Serial.write("U/D: ");
  Serial.println(UD, DEC);
  Serial.write("L/R: ");
  Serial.println(LR, DEC);

/*
  Full Scale:
    Center(ave) -> UD =583, LR=469
    Up = 1023
    Down(ave) = 83
    Left = 0
    Right(ave) = 968

*/

 }

